import React, { Component } from 'react'

import './swipertop.scss'
import {connect} from 'react-redux'
import {getSwiperList} from '../../../store/actionCreator/indexActionCreator'
import store from '../../../store'
 class swipertopimg extends Component {
    // constructor(props){
    //     super(props)
    // }
    componentDidMount(){
        store.dispatch(getSwiperList())
    }
  
    render() {
        return (
            <div >
             <div>
               {/* 顶部图片 */}
                <div className='topImg'>
                    <img src="https://s10.mogucdn.com/mlcdn/c45406/200918_5eilfd679e68hi8h57i27eailbg2c_750x500.jpg" alt=""/>
                    </div>
                    <div className='topImg'>
                        <img src="https://s10.mogucdn.com/mlcdn/c45406/200918_18ed5i6agj6564f893bl2bggj3e7h_750x500.jpg" alt=""/>
                    </div>
                    <div className='topImgText'>
                        <img src="https://s10.mogucdn.com/mlcdn/c45406/200918_286j91il9424hh3if860jl41ddhfe_750x297.jpg" alt=""/>
                    </div>
                </div>
                {/* 推荐 */}
                <div className='topImgBox'>
                    {this.props.dataimg.map((v,i)=>{
                        return <div key={v.id} className='topImg'>
                            <img src={v.img_url} alt=""/>
                        </div>
                    })}
                </div>
            </div>
        )
    }
}
const mapStateToProps = (state)=>{
   return{
    dataimg:state.SwiperContReducer.dataimg
   }
}

export default  connect(mapStateToProps,null)(swipertopimg)